home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / zmodem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-01-01  |  10.8 KB  |  263 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                 Zmodem definitions for BinkleyTerm 2.10                  */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  24. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  25. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  26. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  27. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*    The Authors can be reached at the following addresses:                */
  31. /*                                                                          */
  32. /*    Robert C. Hartman                      Vincent E. Perriello           */
  33. /*    Spark Software                         VEP Software                   */
  34. /*    427-3 Amherst Street                   111 Carroll Street             */
  35. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  36. /*    Nashua, NH 03061                                                      */
  37. /*                                                                          */
  38. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  39. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  40. /*                                                                          */
  41. /*    Please feel free to contact us at any time to share your comments     */
  42. /*    about our software and/or licensing policies.                         */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*  This module is based largely on a similar module in OPUS-CBCS V1.03b.   */
  46. /*  The original work is (C) Copyright 1986, Wynn Wagner III. The original  */
  47. /*  authors have graciously allowed us to use their code in this work.      */
  48. /*                                                                          */
  49. /*--------------------------------------------------------------------------*/
  50.  
  51.  
  52. #include <sys\types.h>
  53. #include <sys\stat.h>
  54. #include <stdio.h>
  55. #include <fcntl.h>
  56. #include <ctype.h>
  57.  
  58. #define flushmo() wait_for_clear()
  59. #define Z_UpdateCRC(cp,crc) ( crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
  60. #define Z_32UpdateCRC(c,crc) (cr3tab[((int) crc ^ c) & 0xff] ^ ((crc >> 8) & 0x00FFFFFF))
  61.  
  62.  
  63.  
  64.  
  65. /*--------------------------------------------------------------------------*/
  66. /* Routines from N_Zmodem.H ...                                             */
  67. /*--------------------------------------------------------------------------*/
  68.  
  69. #define ZPAD            '*'
  70. #define ZDLE            030
  71. #define ZDLEE           (ZDLE^0100)
  72. #define ZBIN            'A'
  73. #define ZHEX            'B'
  74. #define ZBIN32          'C'
  75.  
  76. /*--------------------------------------------------------------------------*/
  77. /* Frame types (see array "frametypes" in zm.c)                             */
  78. /*--------------------------------------------------------------------------*/
  79. #define ZRQINIT         0
  80. #define ZRINIT          1
  81. #define ZSINIT          2
  82. #define ZACK            3
  83. #define ZFILE           4
  84. #define ZSKIP           5
  85. #define ZNAK            6
  86. #define ZABORT          7
  87. #define ZFIN            8
  88. #define ZRPOS           9
  89. #define ZDATA           10
  90. #define ZEOF            11
  91. #define ZFERR           12
  92. #define ZCRC            13
  93. #define ZCHALLENGE      14
  94. #define ZCOMPL          15
  95. #define ZCAN            16
  96. #define ZFREECNT        17
  97. #define ZCOMMAND        18
  98. #define ZSTDERR         19
  99.  
  100. /*--------------------------------------------------------------------------*/
  101. /* ZDLE sequences                                                           */
  102. /*--------------------------------------------------------------------------*/
  103. #define ZCRCE           'h'
  104. #define ZCRCG           'i'
  105. #define ZCRCQ           'j'
  106. #define ZCRCW           'k'
  107. #define ZRUB0           'l'
  108. #define ZRUB1           'm'
  109.  
  110. /*--------------------------------------------------------------------------*/
  111. /* Z_GetZDL return values (internal)                                        */
  112. /* -1 is general error, -2 is timeout                                       */
  113. /*--------------------------------------------------------------------------*/
  114. #define GOTOR           0400
  115. #define GOTCRCE         (ZCRCE|GOTOR)
  116. #define GOTCRCG         (ZCRCG|GOTOR)
  117. #define GOTCRCQ         (ZCRCQ|GOTOR)
  118. #define GOTCRCW         (ZCRCW|GOTOR)
  119. #define GOTCAN          (GOTOR|030)
  120.  
  121. /*--------------------------------------------------------------------------*/
  122. /* Byte positions within header array                                       */
  123. /*--------------------------------------------------------------------------*/
  124. #define ZF0             3
  125. #define ZF1             2
  126. #define ZF2             1
  127. #define ZF3             0
  128. #define ZP0             0
  129. #define ZP1             1
  130. #define ZP2             2
  131. #define ZP3             3
  132.  
  133. /*--------------------------------------------------------------------------*/
  134. /* Bit Masks for ZRINIT flags byte ZF0                                      */
  135. /*--------------------------------------------------------------------------*/
  136. #define CANFDX          01
  137. #define CANOVIO         02
  138. #define CANBRK          04
  139. #define CANCRY          010
  140. #define CANLZW          020
  141. #define CANFC32         040
  142.  
  143.  
  144.  
  145.  
  146.  
  147. /*--------------------------------------------------------------------------*/
  148. /* PARAMETERS FOR ZFILE FRAME...                                            */
  149. /*--------------------------------------------------------------------------*/
  150.  
  151. /*--------------------------------------------------------------------------*/
  152. /* Conversion options one of these in ZF0                                   */
  153. /*--------------------------------------------------------------------------*/
  154. #define ZCBIN           1
  155. #define ZCNL            2
  156. #define ZCRESUM         3
  157.  
  158. /*--------------------------------------------------------------------------*/
  159. /* Management options, one of these in ZF1                                  */
  160. /*--------------------------------------------------------------------------*/
  161. #define ZMNEW           1
  162. #define ZMCRC           2
  163. #define ZMAPND          3
  164. #define ZMCLOB          4
  165. #define ZMSPARS         5
  166. #define ZMDIFF          6
  167. #define ZMPROT          7
  168.  
  169. /*--------------------------------------------------------------------------*/
  170. /* Transport options, one of these in ZF2                                   */
  171. /*--------------------------------------------------------------------------*/
  172. #define ZTLZW           1
  173. #define ZTCRYPT         2
  174. #define ZTRLE           3
  175.  
  176. /*--------------------------------------------------------------------------*/
  177. /* Parameters for ZCOMMAND frame ZF0 (otherwise 0)                          */
  178. /*--------------------------------------------------------------------------*/
  179. #define ZCACK1          1
  180.  
  181.  
  182.  
  183.  
  184.  
  185. /*--------------------------------------------------------------------------*/
  186. /* Miscellaneous definitions                                                */
  187. /*--------------------------------------------------------------------------*/
  188. #define OK              0
  189. #define ERROR           (-1)
  190. #define TIMEOUT         (-2)
  191. #define RCDO            (-3)
  192. #define FUBAR           (-4)
  193.  
  194. #define XON             ('Q'&037)
  195. #define XOFF            ('S'&037)
  196. #define CPMEOF          ('Z'&037)
  197.  
  198. #define RXBINARY        FALSE
  199. #define RXASCII         FALSE
  200. #define LZCONV          0
  201. #define LZMANAG         0
  202. #define LZTRANS         0
  203. #define PATHLEN         128
  204. #define KSIZE           1024
  205. #define WAZOOMAX        8192
  206. #define SECSPERDAY      (24L*60L*60L)
  207.  
  208.  
  209.  
  210. /*--------------------------------------------------------------------------*/
  211. /* Parameters for calling ZMODEM routines                                   */
  212. /*--------------------------------------------------------------------------*/
  213. #define SPEC_COND       2
  214. #define TRUE            1
  215. #define FALSE           0
  216. #define END_BATCH       (-1)
  217. #define NOTHING_TO_DO   (-2)
  218. #define DELETE_AFTER    '-'
  219. #define TRUNC_AFTER     '#'
  220. #define NOTHING_AFTER   '@'
  221. #define DO_WAZOO        TRUE
  222. #define DONT_WAZOO      FALSE
  223.  
  224.  
  225. /*--------------------------------------------------------------------------*/
  226. /* ASCII MNEMONICS                                                          */
  227. /*--------------------------------------------------------------------------*/
  228. #define NUL 0x00
  229. #define SOH 0x01
  230. #define STX 0x02
  231. #define ETX 0x03
  232. #define EOT 0x04
  233. #define ENQ 0x05
  234. #define ACK 0x06
  235. #define BEL 0x07
  236. #define BS  0x08
  237. #define HT  0x09
  238. #define LF  0x0a
  239. #define VT  0x0b
  240. #define FF  0x0c
  241. #define CR  0x0d
  242. #define SO  0x0e
  243. #define SI  0x0f
  244. #define DLE 0x10
  245. #define DC1 0x11
  246. #define DC2 0x12
  247. #define DC3 0x13
  248. #define DC4 0x14
  249. #define NAK 0x15
  250. #define SYN 0x16
  251. #define ETB 0x17
  252. #define CAN 0x18
  253. #define EM  0x19
  254. #define SUB 0x1a
  255. #define ESC 0x1b
  256. #define FS  0x1c
  257. #define GS  0x1d
  258. #define RS  0x1e
  259. #define US  0x1f
  260.  
  261.  
  262. /* END OF FILE: zmodem.h */
  263.